package flc.ast.adapter;

import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class QuestionAdapter extends StkProviderMultiAdapter<String> {

    public QuestionAdapter() {
        addItemProvider(new StkSingleSpanProvider(38));
        addItemProvider(new QuestionProvider());
    }

    private class QuestionProvider extends BaseItemProvider<String> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_question;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, String bean) {
            baseViewHolder.setText(R.id.tvQuestionItemName, bean);
            if (baseViewHolder.getBindingAdapterPosition() == 0) {
                baseViewHolder.getView(R.id.line).setVisibility(View.GONE);
            } else {
                baseViewHolder.getView(R.id.line).setVisibility(View.VISIBLE);
            }
        }
    }

}
